%::PROVIDES=(
	name	=> ["PARTITIONED","UNPARTITIONED"],
	desc	=> ["Changes set of cldaemon connectivity to rest of cluster."],
	type	=> "request",
	code	=> \&::do_handle_partitioned
);

sub ::do_handle_partitioned {
my $args=shift;
my $cmdname=$args->{"_CMDNAME"};
my $action="die";
my $ext_action=undef;

	if(exists($xml->{global}->{on_partition}) &&
		lc($xml->{global}->{on_partition}) eq "wait") {
		$action="wait";
	}
	if(exists($xml->{global}->{on_partition_cmd})) {
		$ext_action=$xml->{global}->{on_partition_cmd};
		my $h=hostname;
		$ext_action =~ s!\%N!$h!g;
		$::PARTITIONED_EXTCMD=$ext_action;
		::logmsg("Set external partitioned command to perform to:");
		::logmsg($::PARTITIONED_EXTCMD);
	}

	if($cmdname eq "PARTITIONED") {
		$::NODE_STATE="PARTITIONED";
		::logmsg("Action to perform - '$action'.");
		if($action eq "die") {
			if(-f "/opt/linuxha14/tools/dusp" &&
			   -x "/opt/linuxha14/tools/dusp") {
				$::PARTITIONED_CMD="/opt/linuxha14/tools/dusp";
			} else {
				logwarn("Unable to force restart of local server -");
				logwarn("performing standard reboot instead.");
				$::PARTITIONED_CMD="/sbin/reboot";
			}
		}
		return "OK";
	}
	# If we have forward set local status to partitioned.
	if(exists($args->{FORWARD})) {
		$::NODE_STATE="UP";
		do_it("UNPARTITIONED");
	} else {
		# Otherwise assume the OTHER node is OK
		$::OTHER_NODE_STATE="UP";
	}
	return "OK";
}
1;
